-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhancement]: Add interface service_policy
parameter
#332
base: integration/main
Are you sure you want to change the base?
[Enhancement]: Add interface service_policy
parameter
#332
Conversation
71823b2
to
1de03df
Compare
d2aa5ab
to
2552062
Compare
39b39bc
to
dd0999b
Compare
* "default-management" if scope is cluster and IPspace is not Cluster (not yet implemented) | ||
* "default-cluster" if scope is cluster and IPspace is Cluster (not yet implemented) | ||
*/ | ||
Default: stringdefault.StaticString("default-data-files"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In ONTAP 9.6 API document:
If not specified in POST, the following default property values are assigned:
:
service_policy:
default-data-files if scope is svm
default-management if scope is cluster and IPspace is not Cluster
default-cluster if scope is svm and IPspace is Cluster
The default value can be found in query API. And it does not have to be set in the POST API call. So, it should not be set here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @chuyich, thank you very much for reviewing this PR.
I did add a default value for the following reason: without a default value, when there is no configuration supplied, Terraform will mark the attribute as unknown. Unknown attributes are constantly displayed as "(known after apply)" in plan outputs... the default value is to reduce these "(known after apply)" plan outputs.
I'm happy to remove the default value, though - just wanted to double-check that the behavior mentioned above is indeed desired in this case.
Thanks much for a quick confirmation!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it could be one of 3 values based on the scope, set any of them may not be correct. It's better to use this way:
https://github.com/NetApp/terraform-provider-netapp-ontap/blob/integration/main/internal/provider/name_services/name_services_ldap_resource.go#L106
PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), },
We found setting default values may cause issues in some cases. The above will cover the case you mentioned. Also after you remove the default value part, the parameter handling needs to be adjusted accordingly. You may use the above case as a reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood. I've removed the default value, and added logic for fetching the value computed by ONTAP API instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In resource, the field service_policy should not be set default value at the beginning. Based on the API (9.6) document, this field does not have to be set in the POST API call. Please make change accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing updates to the documentation pages for the new options.
Signed-off-by: Achim Christ <[email protected]>
Signed-off-by: Achim Christ <[email protected]>
… parameter Signed-off-by: Achim Christ <[email protected]>
Signed-off-by: Achim Christ <[email protected]>
Signed-off-by: Achim Christ <[email protected]>
dd0999b
to
57fc48c
Compare
Signed-off-by: Achim Christ <[email protected]>
Thanks @carchi8py and @chuyich for your feedback! I've removed the default value for Thanks much! |
Adds ability to configure
service_policy
parameter of IP Interfaces.Closes #306.
Acceptance tests pass:
$ TF_ACC=1 go test ./internal/provider/networking/network_ip_interface_resource_test.go -v === RUN TestAccNetworkIpInterfaceResource --- PASS: TestAccNetworkIpInterfaceResource (4.44s) PASS ok command-line-arguments 4.449s
$ TF_ACC=1 go test ./internal/provider/networking/network_ip_interface_resource_alias_test.go -v === RUN TestAccNetworkIpInterfaceResourceAlias --- PASS: TestAccNetworkIpInterfaceResourceAlias (3.93s) PASS ok command-line-arguments 3.935s
Example Terraform Configuration: